﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SysRoutes
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }

        private void administradorBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.administradorBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.sysRoutesDataSet);

        }

        private void Login_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'sysRoutesDataSet.Administrador' table. You can move, or remove it, as needed.
            this.administradorTableAdapter.Fill(this.sysRoutesDataSet.Administrador);

        }

        private void button1_Click(object sender, EventArgs e)
        {
            int result = administradorTableAdapter.FillByAdministradorLogin(sysRoutesDataSet.Administrador, textBox1.Text, textBox2.Text);

            if (result == 1)
            {
                Menu f = new Menu();

                f.Show();

                this.Visible = false;
            }
            else
            {
                MessageBox.Show("Usuário e/ou Senha Inválido", "Erro" ,MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}
